home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333)))) ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- pciio_intr: pciio_intr_alloc, pciio_intr_connect, pciio_intr_disconnect,
- pciio_intr_free - manage PCI Interrupts
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////PPPPCCCCIIII////ppppcccciiiiiiiioooo....hhhh>>>>
-
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____tttt
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____aaaalllllllloooocccc((((
- vvvveeeerrrrtttteeeexxxx____hhhhddddllll____tttt _v_h_d_l,,,,
- ddddeeeevvvviiiicccceeee____ddddeeeesssscccc____tttt _d_e_s_c,,,,
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____lllliiiinnnneeee____tttt _l_i_n_e_s,,,,
- vvvveeeerrrrtttteeeexxxx____hhhhddddllll____tttt _o_w_n_e_r))))
-
- iiiinnnntttt
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____ccccoooonnnnnnnneeeecccctttt((((
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____tttt _i_n_t_r,,,,
- iiiinnnnttttrrrr____ffffuuuunnnncccc____tttt _f_u_n_c,,,,
- iiiinnnnttttrrrr____aaaarrrrgggg____tttt _a_r_g,,,,
- vvvvooooiiiidddd ****_t_h_r_e_a_d))))
-
- vvvvooooiiiidddd
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____ddddiiiissssccccoooonnnnnnnneeeecccctttt((((ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____tttt _i_n_t_r))))
-
- vvvvooooiiiidddd
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____ffffrrrreeeeeeee((((ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____tttt _i_n_t_r))))
-
- AAAArrrrgggguuuummmmeeeennnnttttssss
- _a_r_g A parameter to pass to _f_u_n_c() when this particular interrupt
- occurs, commonly a pointer to a driver-private data structure.
-
- _d_e_s_c A device descriptor, usually zero.
-
- _f_u_n_c The function to perform interrupt service.
-
- _i_n_t_r The interrupt channel handle returned by _p_c_i_i_o__i_n_t_r__a_l_l_o_c().
-
- _l_i_n_e_s Specifies one or more of the PCI Interrupt pins used by the
- device.
-
- _o_w_n_e_r An appropriate vertex handle to use when printing messages about
- this particular interrupt, and is usually a vertex created by the
- device driver.
-
- _v_h_d_l The PCI device connection point as passed to the driver _a_t_t_a_c_h()
- entry point.
-
- _t_h_r_e_a_d Reserved, should be NULL.
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333)))) ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333))))
-
-
-
- DESCRIPTION
- When a device driver wishes to accept interrupt events from a device, the
- system needs to make sure that there is a path from the PCI interrupt pin
- to the appropriate CPU interrupt hardware. This is split into two
- separate phases, establishing the channel and connecting a service
- function, so that the service function can be changed or disconnected
- without losing the allocated hardware resources.
-
- The driver is responsible for connecting an interrupt handler when the
- device needs one, and for disconnecting the handler when it does not.
-
- The interrupt delivery mechanism depends on the address of the interrupt
- function. It is important to disconnect interrupts before a driver
- unloads, otherwise the PCI infrastructure might call a nonexistent
- function. (A driver cannot be auto-loaded when an interrupt occurs.)
-
- The necessary sequence of calls is based on the use of the driver entry
- points, as follows:
-
- _r_e_g() Driver registers to handle a class of PCI devices, triggering
- _a_t_t_a_c_h() calls.
-
- _a_t_t_a_c_h() Driver calls _p_c_i_i_o__i_n_t_r__a_l_l_o_c() to established interrupt
- connectivity between the device and the processor. The
- designated interrupts are disabled at this point. If
- interrupts can occur and are needed at this time, a call to
- _p_c_i_i_o__i_n_t_r__c_o_n_n_e_c_t() enables interrupts and directs them to
- the designated handler.
-
- _u_n_l_o_a_d() The driver is to be unloaded automatically or by operator
- command. The driver text is going to be removed, so it is
- important for all interrupts to be disconnected.
- _p_c_i_i_o__i_t_e_r_a_t_e() can be used to apply to each of the driver's
- connection points, a function that can calls
- _p_c_i_i_o__i_n_t_r__d_i_s_c_o_n_n_e_c_t() as appropriate. It is not necessary
- or desirable to call _p_c_i_i_o__i_n_t_r__f_r_e_e() at this time.
-
- _i_n_i_t() The device driver is being loaded or reloaded. It can again
- use _p_c_i_i_o__i_t_e_r_a_t_e(), this time to call a function that re-
- connects interrupts to the new addresses of their service
- functions. No special logic is needed to avoid this at the
- initial load time, because _p_c_i_i_o__i_t_e_r_a_t_e() is a no-operation
- when the device driver is not registered.
-
- _d_e_t_a_c_h() A device is being detached and will no longer be accessible.
- The driver calls both _p_c_i_i_o__i_n_t_r__d_i_s_c_o_n_n_e_c_t() and
- _p_c_i_i_o__i_n_t_r__f_r_e_e() for this particular device.
-
- _u_n_r_e_g() The device driver is shutting down. It calls
- _p_c_i_i_o__d_r_i_v_e_r__u_n_r_e_g_i_s_t_e_r(). This triggers a call to the
- _d_e_t_a_c_h() entry point for every attached device.
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333)))) ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333))))
-
-
-
- Some devices do not require interrupt service when they are not open.
- Leaving an interrupt allocated but not connected keeps the interrupt
- disabled, possibly reducing impact on the system from handling interrupts
- from devices that do not actually need service.
-
- If this is the situation, then the scenario above may be somewhat
- simplified:
-
- _a_t_t_a_c_h() Allocate the interrupt to establish a connection and disable
- the interrupt. Only connect the interrupt if interrupts are
- required as part of device initialization; then disconnect
- it.
-
- _o_p_e_n() If the interrupt is not yet connected, connect it.
-
- _c_l_o_s_e() No processes have the device open; disconnect the interrupt
- when all pending I/O is complete or purged.
-
- _u_n_l_o_a_d() The driver is not called to unload when one of its devices is
- open, so no interrupts should be connected.
-
- _d_e_t_a_c_h() Devices are closed before detaching, so no interrupts should
- be connected.
-
- SSSSppppeeeecccciiiiffffyyyyiiiinnnngggg PPPPCCCCIIII IIIInnnntttteeeerrrrrrrruuuupppptttt LLLLiiiinnnneeeessss
- The _l_i_n_e_s parameter is formed by or-ing together appropriate flags:
-
- PCIIO_INTR_LINE_A
- PCIIO_INTR_LINE_B
- PCIIO_INTR_LINE_C
- PCIIO_INTR_LINE_D
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- Here is how a typical PCI device driver might get interrupt service
- started.
- ppppcccciiiiffffoooooooo____aaaattttttttaaaacccchhhh((((vvvveeeerrrrtttteeeexxxx____hhhhddddllll____tttt ppppccccoooonnnnnnnn____vvvvhhhhddddllll))))
- {{{{
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____tttt iiiinnnnttttrrrr;;;;
- ............
- ////**** TTTThhhhiiiissss ddddeeeevvvviiiicccceeee uuuusssseeeessss bbbbooootttthhhh IIIINNNNTTTTAAAA aaaannnndddd IIIINNNNTTTTBBBB,,,,
- **** aaaannnndddd tttthhhhiiiissss ddddrrrriiiivvvveeeerrrr wwwwaaaannnnttttssss bbbbooootttthhhh rrrroooouuuutttteeeedddd ttttoooo
- **** tttthhhheeee ssssaaaammmmeeee iiiinnnntttteeeerrrrrrrruuuupppptttt sssseeeerrrrvvvviiiicccceeee ffffuuuunnnnccccttttiiiioooonnnn....
- ****////
- iiiinnnnttttrrrr ==== ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____aaaalllllllloooocccc((((ppppccccoooonnnnnnnn____vvvvhhhhddddllll,,,, 0000,,,,
- PPPPCCCCIIIIIIIIOOOO____IIIINNNNTTTTRRRR____LLLLIIIINNNNEEEE____AAAA||||
- PPPPCCCCIIIIIIIIOOOO____IIIINNNNTTTTRRRR____LLLLIIIINNNNEEEE____BBBB,,,,
- ppppcccciiiiffffoooooooo____vvvvhhhhddddllll))));;;;
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr____ccccoooonnnnnnnneeeecccctttt((((iiiinnnnttttrrrr,,,,
- ppppcccciiiiffffoooooooo____iiiinnnnttttrrrr,,,,
- ((((iiiinnnnttttrrrr____aaaarrrrgggg____tttt))))ppppcccciiiiffffoooooooo____ssssoooofffftttt,,,,
- ((((vvvvooooiiiidddd ****))))0000))));;;;
- ............
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333)))) ppppcccciiiiiiiioooo____iiiinnnnttttrrrr((((DDDD3333))))
-
-
-
- }}}}
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- pciio(D3), pciio_config(D3), pciio_dma(D3), pciio_error(D3),
- pciio_get(D3), pciio_pio(D3).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- _p_c_i_i_o__i_n_t_r__a_l_l_o_c() returns a null value if it can not allocate memory.
-
- _p_c_i_i_o__i_n_t_r__c_o_n_n_e_c_t() returns a zero for success or a negative value on
- failure. Since the channel is preallocated, the only interesting failure
- for this function is the attempt to use a null interrupt handle value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-